<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue@2.7.16.js"></script>
    <title>计算属性</title>
</head>

<body>
    <div id="app">
        姓：<input type="text" v-model="firstName" />
        名：<input type="text" v-model="lastName" />

        全名：<span>{{fullName}}</span>
    </div>
</body>

<script>
    const vm = new Vue({
        el: "#app",
        data() {
            return {
                firstName: "",
                lastName: "",
            }
        },
        methods: {},
        computed: {
            fullName: {
                get() {
                    return `${this.firstName}-${this.lastName}`
                },
                set(val) { }
            }
        }
    })
</script>

</html>